#pragma once

#include <XnCppWrapper.h>
#include <vector>
#include <string>
#include "MusicNote\include\MusicNoteLib.h"
#include "utils.h"


class CPlayer
{
public:
	CPlayer();
	~CPlayer();

	void MakeMeasure();
	void Draw(int winX, int winY);

	void AddRoots(Key* chord);//Just to separate these 
	void Add3and5(Key* chord);
	void AddExtra(Key* chord);
	bool Add(note n, int m, bool cont); //Attempts to add note at measure[m]

	void Stringify();

	void SetAttrs(std::vector<float> attributes) {attrs = attributes;}
	void ChangeChord(int c) {chord = c;}
	void FindMode();

	void Smooth();
	void Length();
	void Volume();

	void Play();
	void ClearMeasure();
	void SetProgMode(bool p) {progMode = p;}

	bool IsPlaying() { return mPlayer.IsPlaying(); }

private:
	std::string playStr;
	std::string instr; //Instrument, begin string with this
	std::string mode;
	MusicNoteLib::Player mPlayer;

	int chord;
	Key root;
	Key current;
	int prog; //Chord progression... I, II, III...

	std::vector<float> attrs;
	std::vector< std::vector< note > > measure;

	bool strValid; //Whether playStr is valid
	bool progMode;

};